/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.pbv.azsg.domain;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Enumerated;
import javax.persistence.EnumType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.GeneratedValue;
import javax.xml.bind.annotation.XmlRootElement;


/**
 *
 * @author b.prikhodko
 */
@Entity
@Table(name = "DISPENSER_H", catalog = "", schema = "PBV")
//@SequenceGenerator(name="ID_GEN_SEQ", sequenceName="id_seq", allocationSize = 1)
@XmlRootElement
public class DispenserH implements Serializable {
    
    private static final long serialVersionUID = 1L;
    
    @Id
    @GeneratedValue //( strategy = GenerationType.SEQUENCE, generator = "ID_GEN_SEQ" )
    @Basic(optional = false)
    @Column(nullable = false)
    private Long hid;
    
    @Basic(optional = false)
    @Column(nullable = false)
    private long id;
    
    @Basic(optional = false)
    @Column(nullable = false)
    @Enumerated(EnumType.STRING)
    private Fuel fuel;
    
    @Basic(optional = false)
    @Column(nullable = false)
    private long price;
    
    @Basic(optional = false)
    @Column(nullable = false)
    @Temporal(TemporalType.TIMESTAMP)
    private Date modified;
    
    @Column(length = 3)
    private String operation;

    public DispenserH() {
    }

    public DispenserH(Long hid) {
        this.hid = hid;
    }

    public DispenserH(Long hid, long id, Fuel fuel, long price, Date modified) {
        this.hid = hid;
        this.id = id;
        this.fuel = fuel;
        this.price = price;
        this.modified = modified;
    }

    public DispenserH(Dispenser dispenser, String operation) {
        
        this.id         = dispenser.getId();
        this.fuel       = dispenser.getFuel();
        this.price      = dispenser.getPrice();
        this.modified   = dispenser.getModified();
        this.operation  = operation;
    }

    public Long getHid() {
        return hid;
    }

    public void setHid(Long hid) {
        this.hid = hid;
    }

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public Fuel getFuel() {
        return fuel;
    }

    public void setFuel(Fuel fuel) {
        this.fuel = fuel;
    }

    public long getPrice() {
        return price;
    }

    public void setPrice(long price) {
        this.price = price;
    }

    public Date getModified() {
        return modified;
    }

    public void setModified(Date modified) {
        this.modified = modified;
    }

    public String getOperation() {
        return operation;
    }

    public void setOperation(String operation) {
        this.operation = operation;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (hid != null ? hid.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof DispenserH)) {
            return false;
        }
        DispenserH other = (DispenserH) object;
        if ((this.hid == null && other.hid != null) || (this.hid != null && !this.hid.equals(other.hid))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.pbv.azsg.domain.DispenserH[ hid=" + hid + " ]";
    }
    
}
